<!DOCTYPE html>
<html lang="cn" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <title>模型字段信息 field Field Form</title>
    <meta name="renderer" content="webkit"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0"/>
    <link rel="stylesheet" th:href="@{/statics/layui/css/layui.css}" media="all"/>
    <link rel="stylesheet" th:href="@{/statics/style/admin.css}" media="all"/>
</head>
<body>

<div class="layui-form" lay-filter="layuiadmin-form-field" id="layuiadmin-form-field" style="padding: 20px 30px 0 0;">
    <div class="layui-form-item">
        <label class="layui-form-label">选择模型</label>
        <div class="layui-input-block">
            <select name="module">
                <option value="0">请选择模型</option>
                <option th:each="m:${modules}" th:value="${m.code}" th:selected="${m.code == field.module ? 'true':'false'}" th:text="${m.name}"/>
            </select>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">字段标题</label>
        <div class="layui-input-block">
            <input type="text" name="title" lay-verify="required" autocomplete="off" placeholder="请输入字段标题"
                   class="layui-input" th:value="${field.title}">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">字段名称</label>
        <div class="layui-input-block">
            <input type="text" name="name" lay-verify="required" autocomplete="off" placeholder="请输入字段名称"
                   class="layui-input" th:value="${field.name}">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">字段类型</label>
        <div class="layui-input-block">
            <select name="type">
                <option value="1" th:selected="${1 == field.type ? 'true':'false'}">单行文本</option>
                <option value="2" th:selected="${2 == field.type ? 'true':'false'}">多行文本</option>
                <option value="3" th:selected="${3 == field.type ? 'true':'false'}">单选按钮</option>
                <option value="4" th:selected="${4 == field.type ? 'true':'false'}">多选按钮</option>
                <option value="5" th:selected="${5 == field.type ? 'true':'false'}">图片上传</option>
                <option value="6" th:selected="${6 == field.type ? 'true':'false'}">附件上传</option>
                <option value="7" th:selected="${7 == field.type ? 'true':'false'}">日期选择</option>
                <!--option value="8" th:selected="${8 == field.type ? 'true':'false'}">编辑器</option-->
                <option value="9" th:selected="${9 == field.type ? 'true':'false'}">下拉选择</option>
                <option value="10" th:selected="${10 == field.type ? 'true':'false'}">关联模型</option>
            </select>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">选择内容值</label>
        <div class="layui-input-block">
            <textarea name="values" placeholder="多个选项用逗号隔开或者回车"  class="layui-textarea">[[${field.values}]]</textarea>
            <div class="layui-form-mid layui-word-aux">只在类型为单选、多选或关联模型时填写有效。</div>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">字段提示</label>
        <div class="layui-input-block">
            <input type="text" name="tip" autocomplete="off" placeholder="请输入字段提示"
                   class="layui-input" th:value="${field.tip}">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">是否必填</label>
        <div class="layui-input-block">
            <div class="layui-input-block">
                <input type="radio" name="required" value="1" title="启用" th:checked="${field.required ==1?'true':'false'}">
                <input type="radio" name="required" value="0" title="禁用" th:checked="${field.required == null || field.required ==0?'true':'false'}">
            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">列表显示</label>
        <div class="layui-input-block">
            <div class="layui-input-block">
                <input type="radio" name="listed" value="1" title="启用" th:checked="${field.listed ==1?'true':'false'}">
                <input type="radio" name="listed" value="0" title="禁用" th:checked="${field.listed == null || field.listed ==0?'true':'false'}">
            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">查询条件</label>
        <div class="layui-input-block">
            <div class="layui-input-block">
                <input type="radio" name="searched" value="1" title="启用" th:checked="${field.searched ==1?'true':'false'}">
                <input type="radio" name="searched" value="0" title="禁用" th:checked="${field.searched == null || field.searched ==0?'true':'false'}">
            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">排序序号</label>
        <div class="layui-input-block">
            <input type="text" name="sorting" autocomplete="off" placeholder="请输入排序序号"
                   class="layui-input" th:value="${field.sorting}">
        </div>
    </div>
    <div class="layui-form-item layui-hide">
        <input type="hidden" name="id" th:value="${field.id}" autocomplete="off" class="layui-input">
        <button class="layui-btn" lay-submit lay-filter="LAY-field-add-submit" id="LAY-field-add-submit">提交</button>
    </div>
</div>

<script th:src="@{/statics/layui/layui.js}"></script>
<script>
    layui.config({
        base: '/statics/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'form'], function () {
        var $ = layui.$
            , form = layui.form;
    })
</script>
</body>
</html>